<!DOCTYPE html>
<title>Test that when tapping on the controls to show them it does not activate the button below.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video controls loop></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");
    video.src = "content/test.ogv";
    video.play();

    video.onplaying = t.step_func(function() {
        runAfterHideMediaControlsTimerFired(t.step_func(function() {
          assert_false(isControlsPanelVisible(video));

          var coords = elementCoordinates(enabledPlayButton(video));

          eventSender.gestureTapDown(coords[0], coords[1]);
          assert_false(video.paused);
          assert_false(isControlsPanelVisible(video));

          eventSender.gestureShowPress(coords[0], coords[1]);
          assert_false(video.paused);
          assert_false(isControlsPanelVisible(video));

          eventSender.gestureTap(coords[0], coords[1]);
          runAfterDoubleTapTimerFired(t.step_func_done(() => {
              // Tap shows the controls and do not pause.
              assert_false(video.paused);
              assert_true(isControlsPanelVisible(video));
          }));
        }), video);
    });
});
</script>
